package com.zw.controller;

import com.zw.vo.LoginBody;
import com.zw.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserLoginController {

    @Autowired
    private SysUserService sysUserService;

    /**
     * 登录方法
     *
     * @param loginBody 登录信息
     * @return 结果
     */
    @PostMapping("/login")
    public Object login(@RequestBody LoginBody loginBody) {
        // 生成令牌
        return sysUserService.login(loginBody.getUsername(), loginBody.getPassword());
    }
}
